<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"
    import="java.util.*"%>
<%
//リクエストスコープから、フォームの入力情報を取得する。
//入力されていなければ、空文字列をセットする。
ArrayList<String> errorMessages = (ArrayList<String>)request.getAttribute("errorMessages");
String shain_no = request.getAttribute("shain_no") != null ? (String)request.getAttribute("shain_no") : "";
String password = request.getAttribute("password") != null ? (String)request.getAttribute("password") : "";
String password_conf = request.getAttribute("password_conf") != null ? (String)request.getAttribute("password_conf") : "";
String first_name = request.getAttribute("first_name") != null ? (String)request.getAttribute("first_name") : "";
String last_name = request.getAttribute("last_name") != null ? (String)request.getAttribute("last_name") : "";
String sex = request.getAttribute("sex") != null ? (String)request.getAttribute("sex") : "";
String enter_date = request.getAttribute("enter_date") != null ? (String)request.getAttribute("enter_date") : "";
String section_code = request.getAttribute("section_code") != null ? (String)request.getAttribute("section_code") : "";
String e_mail = request.getAttribute("e_mail") != null ? (String)request.getAttribute("e_mail") : "";
String checked= "checked=\"checked\"";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="common/css/style.css" media="all" rel="stylesheet" type="text/css"  />
<title>社員情報新規登録画面</title>
</head>
<body>

<!-- wrapper start -->
<div id="wrapper">

<h1>EMS[Employee Management System]</h1>
<!-- header start -->
<div id="header_left">
	<a href="MenuServlet">メニューへ戻る</a><br />
</div>
<div id="header_right">
	<% out.print(session.getAttribute("userName") + "さん"); %>
	<a href="LogoutServlet">ログアウト</a><br />
</div>
<!-- header end -->

<h2>社員情報登録　入力</h2>

<!-- errorMessage start -->
<div id="errorMessage">
<%
if(errorMessages != null && errorMessages.isEmpty() == false){
	for(String error : errorMessages) out.println(error + "<br />");
}%>
</div>
<!-- errorMessage end -->

<!-- contents start -->
<div id="contents">
<p>※は必須項目です</p>
<form method="post" action="NewConfirmServlet">
<table border="1">
	<tr>
	<th>社員番号※</th>
	<td colspan="4"><input type="text" name="shain_no" value="<%= shain_no %>" size="20" maxlength="5" /></td>
	</tr>
	<tr>
	<th>パスワード※</th>
	<td colspan="4"><input type="text" name="password" value="<%= password %>" size="20" maxlength="20" /></td>
	</tr>
	<tr>
	<th>パスワード(確認)※</th>
	<td colspan="4"><input type="text" name="password_conf" value="<%= password_conf %>" size="20" maxlength="20" /></td>
	</tr>
	<tr>
	<th scope="rowgroup">名前(漢字)※</th>
	<th>姓</th>
	<td><input type="text" name="first_name" value="<%= first_name %>" size="20" maxlength="10" /></td>
	<th>名</th>
	<td><input type="text" name="last_name" value="<%= last_name %>" size="20" maxlength="10" /></td>
	</tr>
	<tr>
	<th>性別※</th>
	<td colspan="4">男性<input type="radio" name="sex" value="0" <%if (sex.equals("0") | sex.equals("")){out.print(checked);} %> />
		女性<input type="radio" name="sex" value="1" <%if (sex.equals("1")){out.print(checked);}%> />
	</td>
	</tr>
	<tr>
	<th>入社年月日※</th><td colspan="4"><input type="text" value="<%= enter_date%>" name="enter_date" size="20" maxlength="8" /></td>
	</tr>
	<tr>
	<th>部門※</th>
	<td colspan="4"><select name="section_code" >
			<option value="1100" <% if(section_code.equals("1100")){out.print("selected");}%>>部門A1</option>
			<option value="1200" <% if(section_code.equals("1200")){out.print("selected");}%>>部門A2</option>
			<option value="1300" <% if(section_code.equals("1300")){out.print("selected");}%>>部門A3</option>
			<option value="2100" <% if(section_code.equals("2100")){out.print("selected");}%>>部門B1</option>
			<option value="2200" <% if(section_code.equals("2200")){out.print("selected");}%>>部門B2</option>
			<option value="2300" <% if(section_code.equals("2300")){out.print("selected");}%>>部門B3</option>
			<option value="3100" <% if(section_code.equals("3100")){out.print("selected");}%>>部門C1</option>
			<option value="3200" <% if(section_code.equals("3200")){out.print("selected");}%>>部門C2</option>
			<option value="3300" <% if(section_code.equals("3300")){out.print("selected");}%>>部門C3</option>
		</select>
	</td>
	</tr>
	<tr>
	<th>メールアドレス</th><td colspan="4"><input type="text" name="e_mail" value="<%= e_mail %>" size="40" maxlength="256" /></td>
	</tr>
</table>
<input type="button" value="戻る" onclick="javascript:history.back()" />
<input type="submit" value="確認画面へ" />
</form>
</div>
<!-- contents end -->

</div>
<!-- wrapper end-->
</body>
</html>